
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%
    String path = request.getContextPath();
%>
<html>
<head>
    <title>Title</title>
    <jsp:include page="WEB-INF/jsp/common/css_js.jsp"/>


</head>
<body>
<div class="left1">
    <img width="100%" height="100%" class="anim_fade_image" src="<%=path%>/img/lf1.jpg" />
    <img width="100%" height="100%" src="<%=path%>/img/lf10.png" />
</div>

<div class="right1">
    <br><br><br>
    <h1>欢迎注册</h1>
    <h3>开启美食</h3>

    <div>
        <br>
        <form>
            <div class="form-group">
                <label >用户名</label>
                <input type="text" class="form-control"  id="inputName1"  placeholder="请输入用户名">
                <%--                <small  class="form-text text-muted">We'll never share your information with anyone else.</small>--%>
            </div>
            <div class="form-group">
                <label for="inputPassword1">密码</label>
                <input type="password" class="form-control" id="inputPassword1" placeholder="输入密码">
            </div>
            <div class="form-group">
                <label for="exampleInputPassword2">再次确认密码</label>
                <input type="password" class="form-control" id="exampleInputPassword2" placeholder="">
                <small  class="form-text text-muted">两次密码需一致</small>
            </div>

            <button type="button" class="btn btn-primary btn-lg btn-block" onclick="customerAdd()">立即注册</button>
        </form>

    </div>
    <br><br><br><br>
    <hr size="4" color="#D9D9D9" width="100%" align="center"/>
    <p align="center" >Copyright 2021-2022 @HQYJ </p>
</div>

<script>
    function customerAdd() {
        $.ajax({
            url:"customer/register",
            method:"post",
            data:{
                username:$("#inputName1").val(),
                password:$("#inputPassword1").val(),
                password2:$("#exampleInputPassword2").val(),
            },
            dataType: "json",
            success:function (data) {
                if (data['code']==1){
                    alert(data['message']);
                    location.href="index.jsp";
                }else{
                    alert(data['message']);
                }

            },error:function (e) {
                console.log(e);
            }
        })
    }
</script>


</body>
</html>
